#include "sys_Delay.h"

void Delay_ms(uint32_t Delay)
{
    uint32_t tickstart = HAL_GetTick();
    uint32_t wait = Delay;
    if (wait < HAL_MAX_DELAY)
    {
        wait += (uint32_t)(uwTickFreq);
    }
    /* 添加溢出处理定时器 */
    if (HAL_MAX_DELAY - tickstart < wait)
    {
        while (HAL_GetTick() > tickstart)
        {
        }
        while (HAL_GetTick() < wait - (HAL_MAX_DELAY - tickstart))
        {
        }
    }
    else
        while ((HAL_GetTick() - tickstart) < wait)
        {
        }
}
